﻿using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;

public class DynamicLoadTexture : MonoBehaviour
{

    public string url;

    // Use this for initialization
    IEnumerator Start()
    {
        WWW www = new WWW(url);
        yield return www;
        MeshRenderer meshRenderer = gameObject.GetComponent<MeshRenderer>();
        if (meshRenderer == null)
        {
            gameObject.AddComponent<MeshRenderer>();
        }
        meshRenderer.material.mainTexture = www.texture;
    }

    // Update is called once per frame
    void Update()
    {

    }

}
